package org.jili.novoland.listener;

import org.jili.novoland.base.LayerManager;

import android.view.MotionEvent;
import android.view.View;

public class ControlListener implements IControlListener {
    private IControlListener listener;

    public ControlListener(IControlListener listener) {
        super();
        this.listener = listener;
    }

    @Override
    public LayerManager getLayerManager() {
        return listener.getLayerManager();
    }

    public boolean onTouch(View v, MotionEvent event) {
        if( !listener.onTouch(v, event))
            listener = listener.getNextControlListener();
        return true;
    }
    
    final public void setControlListener(IControlListener listener) {
        this.listener = listener;
    }

    @Override
    public IControlListener getNextControlListener() {
        return null;
    }

}
